package com.sap.apitest2.entity;

import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "ProfileGroup")
@Entity
@Table(name="t_profilegroup")
public class ProfileGroup extends AbstractEntity {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="profilegroup_id")
	private Long id;
	
	@Column(name="profilegroup_name")
	private String name;
	
	@Transient
	private Collection<Profile> profiles;

	
	@Override
	public Long getKey() {
		return id;
	}
	
	
	@Override
	public void acceptValue(AbstractEntity input) {
		if(input!=null && input instanceof ProfileGroup){
			ProfileGroup param=(ProfileGroup)input;
			this.setName(param.getName());
		}
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public Collection<Profile> getProfiles() {
		return profiles;
	}


	public void setProfiles(Collection<Profile> profiles) {
		this.profiles = profiles;
	}
	
	
}
